function stat = DLBP_prepare_process(img, param, stat, count)
    nh = param.local_func(img, param.radius, param.neighbors, 0, 'nh');
    nh = sort(nh(:), 1, 'descend'); % sort all patterns by occurrence. 
    s = 0;
    q = 0;
    el = numel(nh);
    while (q < el) && (s < param.ratio) % select available patterns ratio
        q = q + 1; 
        s = s + nh(q);
    end
    fprintf(2, '%d\n', q);
    stat.value = stat.value + q;
    stat.total = stat.total + 1;
end
